<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'jobs-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

        <div class="row">
		<?php echo $form->LabelEx($model['collection'],'date'); ?>
		<?php $this->widget('zii.widgets.jui.CJuiDatePicker',
              array(
                    'model'=>$model['collection'],
                    'attribute'=>"date",
                    'htmlOptions'=>array('value'=>(!empty($model['collection']->date))?(is_numeric($model['collection']->date))?date('d/m/Y',$model['collection']->date):$model['collection']->date:date('d/m/Y')),
                    'options'=>array('dateFormat'=>'dd/mm/yy'),
                   )
             );
?>
	</div>
	<div class="row">
            <?php echo CHtml::label('Collection address','shipper') ?>
            <?php echo $form->dropDownList($model['collection'], 'shipper_add', CHtml::listData($model['cargo']->shipper->address, 'address', 'address'), array('style' => 'width:335px;')); ?>
        </div>
	<?php echo CHtml::label('Additional Information','info') ?>
	<hr />
	<div class="row">
		<?php echo $form->LabelEx($model['collection'],"pkg")?>
		<?php echo $form->TextField($model['collection'],"pkg",array('maxlength'=>125,'size'=>50)); ?>
	</div>
	<div class="row">
		<?php echo $form->LabelEx($model['collection'],'tools'); ?>
		<?php echo $form->TextField($model['collection'],'tools',array('maxlength'=>250,'size'=>50)); ?>
		<?php echo $form->error($model['collection'],'tools'); ?>
	</div>

	<div class="row">
		<?php echo $form->LabelEx($model['collection'],'remark'); ?>
		<?php echo $form->TextArea($model['collection'],'remark',array('cols'=>39,'rows'=>3)); ?>
		<?php echo $form->error($model['collection'],'remark'); ?>
	</div>

	<div class="row buttons">
        <?php
        $this->widget('zii.widgets.jui.CJuiButton',array(
                'name'=>'save_job',
                'caption'=>'Save',
                'value'=>"save_job",
        ));
?>
</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
<?php
$cs = Yii::app()->getClientScript();
$cargoViewURL = CHtml::normalizeUrl(array('cargo/view'));
$script =<<<EOD
$('#jobs-form [type=submit]').click(function(){
	var form = $.extend($.simplelogform,{afterSubmit:function(data){window.location = "$cargoViewURL?id="+data.id;}});
	form.Submit($('#jobs-form'));
	return false;
});
EOD;
$cs->registerScript("jobs#collection#create",$script,CClientScript::POS_END);
?>